package qingke;

public class BubbleSort {

	public static void main(String[] args) {
		int[] array = {2,3,6,4,1,9};
		sort(array);
		for(int s:array){
			System.out.println(s);
		}
	}

	public static void sort(int[] a) {
		int temp = 0;
		for (int i = a.length - 1; i > 0; --i) {
			for (int j = 0; j < i; ++j) {
				if (a[j + 1] < a[j]) {
					temp = a[j];
					a[j] = a[j + 1];
					a[j + 1] = temp;
				}
			}
		}
	}

}
